import 'package:eye_flutter_app/pages/cart-item.dart';
import 'package:eye_flutter_app/pages/cart-num.dart';
import 'package:eye_flutter_app/provider/cart.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class CartPage extends StatefulWidget {
  CartPage({Key? key}) : super(key: key);

  @override
  State<CartPage> createState() => _CartPageState();
}

class _CartPageState extends State<CartPage> {
  @override
  Widget build(BuildContext context) {
    var cartProvider = Provider.of<CartProvider>(context);
    return Scaffold(
      appBar: AppBar(
        title: Text('cart页面'),
      ),
      floatingActionButton: InkWell(
        child: Icon(Icons.add),
        onTap: () {
          cartProvider.addItem('33');
        },
      ),
      body: ListView(
        children: <Widget>[
          CartItem(),
          CartNum(),
        ],
      ),
    );
  }
}
